package ldh.im.base.handler;

import io.netty.channel.*;
import ldh.im.dto.business.ExitResp;

@ChannelHandler.Sharable
public class ExitResponseHandler extends ChannelOutboundHandlerAdapter {

    @Override
    public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
        if (msg instanceof ExitResp) {
            promise.addListener(ChannelFutureListener.CLOSE);
        }
        ctx.write(msg, promise);
    }
}
